You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Dew.Math.Units Namespace > Classes > MtxIntDiff Class > MtxIntDiff Methods > MtxIntDiff.MonteCarlo Method
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
MtxIntDiff.MonteCarlo Method

Numerical integration by Monte Carlo method.

Syntax
C#
Visual Basic
public static double MonteCarlo(TRealFunction Fun, double lb, double ub, [In] TMtxFloatPrecision FloatPrecision, [In] TVec Constants, [In] object[] ObjConst, int N);
Parameters 
Description 
TRealFunction Fun 
Integrating function. 
double lb 
Defines lower bound. 
double ub 
Defines pper bound. 
[In] TMtxFloatPrecision FloatPrecision 
Defines the computational precision to be used by the routine. 
[In] TVec Constants 
Additional constants defining Fun function, usually nil/null. 
[In] object[] ObjConst 
Additional objects defining Fun function, usually nil/null. 
int N 
Number of random points in [lb,ub] interval (see comments above). 

the numerical approximate on integral of function Fun between limits lb and ub.

Performs a numerical integration of function of single variable by using Monte Carlo method.

Evaluate fuction Sin(x) on interval [0,PI] by using Monte Carlo algorithm. 

 

private double IntFun(TVec x, TVec c, params object[] o) { double x = x[0]; return System.Math.Sin(x); } private void Example() { TIntStopReason sr; double area = MtxIntDif.MonteCarlo(IntFun,0.0,System.Math.PI,null,null,65536); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!